#ifndef MEDIAWIKIXMLREADER_H
#define MEDIAWIKIXMLREADER_H

#include <QXmlDefaultHandler>

class CMediawikiXmlReader : public QXmlDefaultHandler
{
public:
	CMediawikiXmlReader(QObject *parent);
	~CMediawikiXmlReader();

	virtual bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts);	
	virtual bool characters(const QString& ch);
	virtual bool endElement(const QString & namespaceURI, const QString & localName, const QString & qName);

private:
	bool m_readingText;
	bool m_errorOccurred;

	QString m_pageName;
	QString m_user;
	QString m_rollbackToken;
	QString m_error;
	QString m_errorCode;
	QString m_editToken;
	QString m_text;
	QString m_loginToken;

public:
	QString GetPageName() const { return m_pageName; };
	QString GetUserName() const { return m_user; };
	QString GetRollbackToken() const { return m_rollbackToken; };
	QString GetEditToken() const { return m_editToken; };
	QString GetLoginToken() const { return m_loginToken; };
	QString GetText() const { return m_text; };

	bool errorOccurred() const { return m_errorOccurred; };
	void ClearError() { m_errorOccurred = false; m_errorCode = ""; m_error = ""; };

	QString GetError() const { return m_error; };
	QString GetErrorCode() const { return m_errorCode; };
	
};

#endif // MEDIAWIKIXMLREADER_H
